package cn.myschool.test.day3;

import cn.myschool.dao.StudentDao;
import cn.myschool.entity.Student;
import cn.myschool.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.Date;

/**
 * @author oldliu
 * @since 1.0
 */
public class TotalTAll {
    public static void main(String[] args) {
        SqlSession s = MybatisUtil.get();
        StudentDao mapper = s.getMapper(StudentDao.class);
//        int total = mapper.findTotal();
//        System.out.println(total);
//        List<Student> datas= mapper.search("1", "5", "王", 1, 10);
//        datas.forEach(x->{
//            System.out.println(x.getStuno()+","+x.getSname());
//        });
        Student st=new Student();
        st.setSname("尼古拉斯-翟坤");
        st.setGradeid(7);
        st.setEnterdate(new Date());
        int add = mapper.add(st);
        System.out.println(add>0?"增加成功":"增加失败");
        MybatisUtil.close(s);
    }
}
